<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father {
            height: 100px;
            width: 100px;
            background-color: aqua;
        }

        .son {
            height: 50px;
            width: 50px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <div class="father">
        <div class="son">son</div>
    </div>
    <script>
        // 常见事件对象的属性和方法
        // 阻止冒泡 dom推荐的标准 stopPropagation()
        var son = document.querySelector('.son')
        son.addEventListener('click', function (e) {
            alert('son')
            e.stopPropagation();
            e.cancelBubble = true; // 非标准浏览器
        },false);
        var father = document.querySelector('.father')
        father.addEventListener('click', function () {
            alert('father')
        },false);
        document.addEventListener('click', function(){
            alert('document');
        },false);
    </script>
</body>
</html>